import {IAddress} from "@/store/myModule/types";

interface IPageInfo {
    pageSize: number
    pageNum: number
    pageTotal: number
}

export interface IShopCarItem {
    id: number
    productId: number
    name: string
    subImages: string
    price: number
    quantity: number
    totalPrice: number
    productSpecsId: number
    productSpecs: any
    checked?: boolean
    isStepperMode?: boolean
}

export interface IState {
    shopCarList: Array<IShopCarItem>
    shopCarSelectGoods: Array<IShopCarItem>
    currentAddress: IAddress
    isShowAddress: boolean
}

interface INeedConfig {
    needToast?: boolean
    needNavigate?: string
}

interface IAddShopCarParams {
    needParams: {
        productId: number
        productSpecsId: number
        productTotal: number
    }
    needConfig?: INeedConfig
}

interface IGetShopCarParams extends INeedConfig {
}

interface ISetShopCarParams extends INeedConfig {
}

interface IUpdateData {
    productSpecsId: number
    productId: number
    productTotal: number
}

interface IUpdateShopCarParams extends INeedConfig {
    data: IUpdateData
}

interface IDeleteShopCarParams extends INeedConfig {
    ids: Array<number>
}

interface ICreateOrderParams {
    data: {
        addressId: number
        ids: Array<number>
        paymentType: string
    }
}

export interface IActions {
    addShopCarAction: (params: IAddShopCarParams) => Promise<boolean>
    getShopCarAction: (params: IGetShopCarParams) => Promise<any>
    setShopCarAction: (params: ISetShopCarParams) => Promise<boolean>
    updateShopCarAction: (params: IUpdateShopCarParams) => Promise<any>
    deleteShopCarAction: (params: IDeleteShopCarParams) => Promise<boolean>
    saveShopCarDataAction: (params: Array<IShopCarItem>) => void
    setCurrentAddressAction: (params: IAddress) => void
    setIsShowAddressAction: (flag: boolean) => void
    createOrderByShoppingAction: (params: ICreateOrderParams) => void
}
